package com.uqbar.asteroids.strategies;


import com.uqbar.asteroids.components.Player;
import com.uqbar.asteroids.scenes.AsteroidScene;
import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.events.constants.Key;

public class EstrategiaPlayer {
	private Key leftKey = Key.A;
	private Key rigthKey = Key.D;
	private Key upKey = Key.W;
	private Key downKey = Key.S;
	private Key shootKey = Key.UP;
	

	public void update(Player player, DeltaState deltaState) {
		
		if(deltaState.isKeyBeingHold(rigthKey)) {
			player.derecha(deltaState.getDelta());
		}
		else if(deltaState.isKeyBeingHold(leftKey)) {
			player.izquierda(deltaState.getDelta());
		}
		
		if(deltaState.isKeyBeingHold(upKey)){
			player.arriba(deltaState.getDelta());
		}else if(deltaState.isKeyBeingHold(downKey)){
			player.abajo(deltaState.getDelta());
		}
		
		if(deltaState.isKeyPressed(shootKey)){
			 player.shoot();
		}
		
	}

	public Key getLeftKey() {
		return leftKey;
	}

	public void setLeftKey(Key leftKey) {
		this.leftKey = leftKey;
	}

	public Key getRigthKey() {
		return rigthKey;
	}

	public void setRigthKey(Key rigthKey) {
		this.rigthKey = rigthKey;
	}
}
